﻿using NetCore_GraphQL.Entity;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reactive.Linq;
using System.Reactive.Subjects;
using System.Threading.Tasks;

namespace NetCore_GraphQL.Services
{
    
    public class SysInfoService
    {
        private static IList<SysInfo> sysInfos = new List<SysInfo>();
        private static readonly ISubject<SysInfo> _eventSteam = new ReplaySubject<SysInfo>();
        public SysInfo Add(SysInfo sysInfo)
        {
            sysInfos.Add(sysInfo);
            _eventSteam.OnNext(sysInfo);
            return sysInfo;
        }
        public IObservable<SysInfo> GetSysInfos()
        {
            return _eventSteam.AsObservable();
            //sysInfos;
        }
    }
}
